<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 创建方式一：字面量创建
      //   var reg = /a/;
      //   var str = "bcuhjk";
      //   console.log(reg.test(str));
      //   创建方式二：内置构造函数创建
      //   var reg = new RegExp("a");
      //   var str = "fnsk";
      //   console.log(reg.test(str));
      var str = "a";
      //   var reg = /str/;
      var str2 = "hsahaijh";
      console.log(reg.test(str2));
    </script>
  </body>
</html>
